package com.ssy.lingxi.message.repository;


import com.ssy.lingxi.message.entity.ImSessionDO;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * IM会话 - 实体仓库
 * @author fhj
 * @version 2.0.0
 * @date 2021/09/17
 */
@Repository
public interface ImSessionRepository extends JpaRepository<ImSessionDO, Long>, JpaSpecificationExecutor<ImSessionDO> {

    List<ImSessionDO> findByMemberIdAndUserIdAndSource(Long memberId, Long userId, Integer source, Sort updateTime);

    List<ImSessionDO> findByMemberIdAndUserIdAndSourceAndSessionMemberId(Long memberId, Long userId, Integer source, Long sessionMemberId, Sort updateTime);

    ImSessionDO findByMemberIdAndUserIdAndSourceAndSessionMemberIdAndSessionUserId(Long memberId, Long userId, Integer source, Long sessionMemberId, Long sessionUserId);

}
